package drename;

import java.io.File;

public class Rename_2 {
	public static void main(String[] args) {
		String rootDir = "results/MOEADD/";
		File file = new File("temp_solution");
		for(File tempDir:file.listFiles()){
			String dirName = tempDir.getName();
			String[] strArray = dirName.split("M");
			String fileDir = rootDir+strArray[0]+"/";
			for(File tempFile:tempDir.listFiles()){
				String fun = tempFile.getName().substring(0,3);
				String run = tempFile.getName().substring(3,tempFile.getName().length());
				if(Integer.parseInt(run)<20){
					StringBuffer toFileName = new StringBuffer(fileDir);
					toFileName.append(fun).append("_").append(strArray[1]).append("D_").append(run);
					System.out.println(toFileName);
					tempFile.renameTo(new File(toFileName.toString()));
				}
			}
			
		}
	}

}
